{extend name="/fool" /}
{block name="css"}
<link rel="stylesheet" href="/css/admin/order_two.css">
<style>
    #page{
        position: relative;
        display: inline-block;
        left:30%;
        margin-left:-50px;
        padding:50px 0;
    }
</style>
{/block}
{block name="menu_content"}
<div id="one">
    <form class="layui-form" action="" method="post">
        <ul>
            <li>
                <div>
                    <div class="layui-input-inline">
                        <div class="layui-input-inline">
                            <input type="text" name="id" autocomplete="off" class="layui-input" placeholder="用户ID">
                        </div>
                        <div class="layui-input-inline">
                            <input type="text" name="name" autocomplete="off" class="layui-input" placeholder="用户昵称">
                        </div>
                    </div>
                </div>
            </li>
            <li>
                <div class="layui-input-inline">
                    <select name="classs_id">
                        <option value="">用户身份</option>
                        <option value="10">普通用户</option>
                        <option value="1">普通会员</option>
                        <option value="3">普通代理商</option>
                        <option value="4">产品区代理</option>
                        <option value="5">产品市代理</option>
                        <option value="7">产品省代理</option>
                    </select>
                </div>
                <button type="Submit" class="layui-btn">筛选</button>
                <button type="button" class="dc layui-btn">Excel导出</button>
            </li>
        </ul>
    </form>
</div>
<div>
    <table>
        <tr>
            <th>用户ID</th>
            <th>用户头像</th>
            <th>用户昵称</th>
            <th>用户身份</th>
            <th>贷款额度（元）</th>
            <th class="last">操作</th>
        </tr>
        {if isset($list)}
        {foreach $list as $v}
        <tr class="list">
            <td>{$v.id}</td>
            <td>
                <img style="width: 40px;" src="{$v.images}" alt="">
            </td>
            <td>{$v.name}</td>
            <td>
                {if $v.canpinsf ==99 && $v.zlsf == 99}
                    {if $v.ptsf == 1}
                    普通会员&nbsp&nbsp
                    {elseif $v.ptsf == 10}
                    普通用户&nbsp&nbsp
                    {elseif $v.ptsf == 2}
                    VIP会员&nbsp&nbsp
                    {elseif $v.ptsf == 3}
                    普通代理商&nbsp&nbsp
                    {/if}
                {/if}
                {if $v.canpinsf == 4}
                产品区代理商&nbsp&nbsp
                {elseif $v.canpinsf == 5}
                产品市代理商&nbsp&nbsp
                {elseif $v.canpinsf == 7}
                产品省代理商&nbsp&nbsp
                {/if}
                {if $v.zlsf == 1}
                租赁区代理商&nbsp&nbsp
                {elseif $v.zlsf == 2}
                租赁市代理商&nbsp&nbsp
                {elseif $v.zlsf == 3}
                租赁省代理商&nbsp&nbsp
                {/if}
            </td>
            <td>{$v.loan}</td>
            <td>
                <button sid="{$v.id}" type="button" class="viewbu layui-btn">详情</button>
            </td>
        </tr>
        {/foreach}
        {/if}
    </table>
    <div id="page">
        {if isset($list)}
        {$page|raw}
        {/if}
    </div>
</div>
<script>
	$(".dc").click(function(){
		location.href = "{:url('dc')}";
	})
    layui.use('form', function(){
        var form = layui.form;

        //监听提交
        form.on('submit(formDemo)', function(data){
            layer.msg(JSON.stringify(data.field));
            return false;
        });
    });
    layui.use('laydate', function(){
        var laydate = layui.laydate;
        //执行一个laydate实例
        laydate.render({
            elem: '#test1'
            ,type: 'month'
            ,range: '至'
            ,format: 'yyyy-MM'
        });
    });
    $(".viewbu").click(function(){
        var id = $(this).attr('sid');
        var url = "{:url('view',['id'=>'6','index'=>'1'])}" + '&view=' + '3' + '&battery_order=' + id;
        console.log(url);
        location.href = url;
    })
    layui.use('laypage', function(){
        var laypage = layui.laypage;
        //执行一个laypage实例
        laypage.render({
            elem: 'page'
            ,count: "{$count}"
            ,curr:"{$curl}"
            ,last:"{$groups}"
            ,limit:"{$limit}"
            ,layout: ['count', 'prev', 'page', 'next', 'limit', 'refresh', 'skip']
            ,jump: function(obj,first){
                console.log(obj)
                if(!first){
                    var url = "{:url('index',['id'=>5,'index'=>0])}" + '&page=' + obj.curr + '&limit=' + obj.limit + '&curr=' + obj.curr;
                    location.href = url;
                }
            }
        });
    });
</script>
{/block}